
let CrudUtils = {
  rowsDeleted : (row, selectedIds, rows, keyFunc, labelFunc) => {
    let curRowId;
    let key = keyFunc(row);
    if(key){
      curRowId = [];
      curRowId.push(key);
    }
    const ids = curRowId || selectedIds;
    return {
      ids: ids,
      msgs: ids.map(id=> labelFunc(rows.find(cur=> keyFunc(cur) === id))).join(",")
    }
  }
}

const install = function(Vue, options) {
  Vue.$CrudUtils = Vue.prototype.$CrudUtils = CrudUtils
}

export default {
  install
}
